home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 November / 1987-11.d64 / fraction pract.2 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  190 lines

  1. 10 rem copyright 1987 compute! publications, inc. - all rights reserved
  2. 20 if peek(65530)=5 then (NULL) 15
  3. 30 ba=53281:bo=53280:if peek(65530)=164 then ba=65301:bo=65305
  4. 40 x=rnd(-ti):deffnc(z1)=int(15*rnd(1))+1
  5. 50 pokeba,1:pokebo,0:printchr$(142)
  6. 60 print"[147]   copyright 1987 compute! pub., inc."
  7. 70 printtab(10)"all rights reserved"
  8. 80 printtab(9)"fraction practice ii[146]"
  9. 90 printtab(9)"which operation?"
  10. 100 printtab(9)"1 = multiplication"
  11. 110 printtab(9)"2 = division ";
  12. 120 inputm:ifm<1orm>2then60
  13. 130 p=0:ti$="000000":print"[147]":pokeba,4:pokebo,7+5*16
  14. 140 cc=0:n=0:x=fnc(z1):y=fnc(z1):if x=y then140
  15. 150 a=fnc(z1):if a=x or a=y then150
  16. 160 b=fnc(z1):if b=a or b=x or b=y then160
  17. 170 p=p+1:if p>20 then1640
  18. 180 if m=2 then gosub1330
  19. 190 gosub1750
  20. 200 print"simplify which numbers?"
  21. 210 print"(if none, type 1)
  22. 220 [133] s1:[139] s1[178]1 [167]810
  23. 230 [139] s1[178]e [167]190
  24. 240 [139] s1[178]x [167][153]""[163]2)"  cmdcmdcmd"x"wait":[137]290
  25. 250 [139] s1[178]y [167][153]""[163]2)"  cmdcmdcmd"y"wait":[137]290
  26. 260 [139] s1[178]a [167][153]""[163]12)"  cmdcmdcmd"a"wait":[137]290
  27. 270 [139] s1[178]b [167][153]""[163]12)"  cmdcmdcmd"b"wait":[137]290
  28. 280 [153]"there isn't a";s1:s1[178]0:[141]1720:[137]190
  29. 290 [133] s2:[139] s2[178]e [167]190
  30. 300 [139] s2[178]b [167][153]""[163]12)"  cmdcmdcmd"b"wait":[137]350
  31. 310 [139] s2[178]a [167][153]""[163]12)"  cmdcmdcmd"a"wait":[137]350
  32. 320 [139] s2[178]y [167][153]""[163]2)"  cmdcmdcmd"y"wait":[137]350
  33. 330 [139] s2[178]x [167][153]""[163]2)"  cmdcmdcmd"x"wait":[137]350
  34. 340 [153]"there isn't a";s2:s2[178]0:[141]1720:[137]190
  35. 350 [139] (c[177]0 [175] s1[178]s2) [176] s1[179][177]s2 [167]370
  36. 360 [153]"only one "s1" can be used here":s1[178]0:s2[178]0:[141]1720:[137]190
  37. 370 [139] s1[178]x [176] s1[178]a [167]390
  38. 380 [139] s1[178]y [176] s1[178]b [167]410
  39. 390 [139] s2[178]y [176] s2[178]b [167]460
  40. 400 [137]420
  41. 410 [139] s2[178]x [176] s2[178]a [167]460
  42. 420 [139] s1[178]s2 [167]360
  43. 430 [153]"you can't simplify two numerators or  "
  44. 440 [153]"two denominators"
  45. 450 s1[178]0:s2[178]0:[141]1720:[137]190
  46. 460 [139] s1[177]s2 [167] d[178]s1:[137]480
  47. 470 d[178]s2
  48. 480 [129] c[178]d [164] 2 [169] [171]1
  49. 490 [139] s1[173]c[178][181](s1[173]c) [175] s2[173]c[178][181](s2[173]c) [167]530
  50. 500 [130] c
  51. 510 [153]"can't simplify those numbers":[141]1720
  52. 520 s1[178]0:s2[178]0:[137]190
  53. 530 [153]"what is the largest number that can"
  54. 540 [153]"divide both"s1"and"s2"?"
  55. 550 [133] c1:[139] c1[178]e [167]190
  56. 560 [139]c1[179]c[167][153]"try a larger numberononononononon":[137]530
  57. 570 [139]c1[177]c[167][153]"too large          ononononononon":[137]530
  58. 580 [153]"                                       "
  59. 590 [153]s1"divided by"c1" =  ";
  60. 600 [133] c2:[139] c2[178]e [167]190
  61. 610 [139] c2[178]s1[173]c1 [167]630
  62. 620 [153]"incorrect...onononon ":[137]580
  63. 630 [153]"                                       "
  64. 640 [139] s1[178]x [167] x[178]s1[173]c1:[153]" "x;"cmd  ":[137]680
  65. 650 [139] s1[178]a [167] a[178]s1[173]c1:[153]" "[163]11)a;"cmd  ":[137]680
  66. 660 [139] s1[178]y [167] y[178]s1[173]c1:[153]" "y;"cmd  ":[137]680
  67. 670 [139] s1[178]b [167] b[178]s1[173]c1:[153]""[163]11)s1[173]c1;"cmd  "
  68. 680 [153]s2"divided by"c1" =  ";
  69. 690 [133] c3:[139] c3[178]e [167]680
  70. 700 [139] c3[178]s2[173]c1 [167] [153]"            ":[137]720
  71. 710 [153]"incorrect...ononon":[137]630
  72. 720 [139] s2[178]b [167] b[178]s2[173]c1:[153]""[163]11)b;"cmd  ":[137]760
  73. 730 [139] s2[178]y [167] y[178]s2[173]c1:[153]" "y;"cmd  ":[137]760
  74. 740 [139] s2[178]a [167] a[178]s2[173]c1:[153]" "[163]11)a;"cmd  ":[137]760
  75. 750 [139] s2[178]x [167] x[178]s2[173]c1:[153]" "x;"cmd  "
  76. 760 [153]"good job! press any key...
  77. 770 get bb$:if bb$=""then770
  78. 780 cc=cc+1
  79. 790 gosub1750
  80. 800 goto200
  81. 810 gosub1750
  82. 820 print"                                "
  83. 830 print"your answer is..."
  84. 840 printtab(4)"[195][195][195][145][157][157][157]"
  85. 850 print"[145]"tab(3);:input n1:if n1=e then190
  86. 860 print"[145]"tab(2)"  "n1"[157]   "
  87. 870 printtab(5)"[195][195]"
  88. 880 printtab(3);:input d1:if d1=e then190
  89. 890 print"[145]"tab(2)"  "d1"[157]   "
  90. 900 if n1=x*a then920
  91. 910 print"wrong numerator...  [145][145][145][145][145][145][145][145]":goto830
  92. 920 if d1=y*b then940
  93. 930 print"wrong denominator...[145][145][145][145][145][145][145][145]":goto830
  94. 940 ifn1<d1 then n2=n1:d2=d1:goto1160
  95. 950 ifn1/d1<>int(n1/d1)then980
  96. 960 print"please change to a whole number...":printtab(7)"[145][145][145][145] =";:input w
  97. 970 goto990
  98. 980 print"please change to a mixed number...":printtab(7)"[145][145][145][145] =";:input w
  99. 990 if w=int(n1/d1) then1020
  100. 1000 if w=e then190
  101. 1010 print"incorrect...[145][145][145][145][157][157]"w"[157]   ":printtab(9)"[145]";:inputw:goto990
  102. 1020 w$=str$(w):a$=left$(w$,2):l=val(a$):n=11:gosub1790
  103. 1030 if w<10 then1070
  104. 1040 a$=mid$(w$,3,1):l=val(a$):n=16:gosub1790
  105. 1050 if w<100 then1070
  106. 1060 a$=mid$(w$,4,1):l=val(a$):n=21:gosub1790
  107. 1070 n=n+4:if int(n1/d1)=n1/d1 then print"":goto1280
  108. 1080 print"[145]"tab(n);:input"[145]";n2
  109. 1090 if n2=e then190
  110. 1100 print"[145]"tab(n)" "n2"[157]   ":printtab(n+2)"[195][195]":printtab(n);
  111. 1110 input d2:print"[145]"tab(n)" "d2"[157]   "
  112. 1120 if d2=e then190
  113. 1130 if n2=n1-(w*d1)then1150
  114. 1140 print"wrong numerator...  [145][145][145][145]": goto1080
  115. 1150 if d2<>d1 thenprint"wrong denominator...[145][145][145][145]":goto1080
  116. 1160 for g=b*y to 2 step -1
  117. 1170 ifn2/g=int(n2/g)andd2/g=int(d2/g)thenprinttab(8)"[145][145]=  ":goto1190
  118. 1180 next g:goto1280
  119. 1190 if n=0 then n=10
  120. 1200 print"please simplify...                [145][145][145][145]":printtab(n+2)"[195][195][145][145]"
  121. 1210 printtab(n);:input s4:print"[145]"tab(n-1)"  "s4"[157]   "
  122. 1220 if s4=e then190
  123. 1230 print""tab(n);:input t2
  124. 1240 if t2=e then190
  125. 1250 print"[145]"tab(n-1)"  "t2"[157]  "
  126. 1260 if s4=n2/g and t2=d2/g then1280
  127. 1270 print"incorrect...please simplify again [145][145][145][145][145][145]":goto1210
  128. 1280 fors=1to3:print"                                      ":nexts
  129. 1290 print"well done![146]"
  130. 1300 t=ti+150
  131. 1310 ift>tithen1310
  132. 1320 goto140
  133. 1330 print"[147]this is problem number";p;"[157]."
  134. 1340 print" "xtab(7)"[209]"tab(11)b
  135. 1350 print" [195][195][195]  [195][195][195]  [195][195][195] ="
  136. 1360 print" "ytab(7)"[209]"tab(11)a
  137. 1370 print"please rewrite the problem correctly
  138. 1380 [153]" lenlenlen       lenlenlen"
  139. 1390 [133]"";x1
  140. 1400 [139] x1[178]e [167]1330
  141. 1410 [153]" "x1"cmd   "
  142. 1420 [139] x1[179][177]x [167][153]"incorrect...":[137]1390
  143. 1430 [153]"                "
  144. 1440 [133]"";y1
  145. 1450 [139] y1[178]e [167]1330
  146. 1460 [153]" "y1"cmd   "
  147. 1470 [139] y1[179][177]y [167][153]"incorrect...":[137]1440
  148. 1480 [153]"                "
  149. 1490 [153]""[163]5);:[133] o$
  150. 1500 o$[178][200](o$,1):[139] o$[178]"e" [167]1330
  151. 1510 [153]"on"[163]5)"  "o$"  "
  152. 1520 [139] o$[179][177]"*" [167] [153]"please use stop* for multiplication...":[137]1490
  153. 1530 [153]""[163]10);:[133] a1
  154. 1540 [139] a1[178]e [167]1330
  155. 1550 [153]""[163]9)"  "a1"cmd   "
  156. 1560 [139] a1[179][177]a [167] [153]"incorrect...                       ":[137]1530
  157. 1570 [153]"                                   "
  158. 1580 [153]""[163]10);
  159. 1590 [133] b1:[139] b1[178]e [167]1330
  160. 1600 [153]""[163]9)"  "b1"cmd   "
  161. 1610 [139] b1[179][177]b [167] [153]"incorrect...":[137]1580
  162. 1620 [141]1720
  163. 1630 [142]
  164. 1640 [153]"load     this set of problems took you
  165. 1650 print"  "left$(ti$,2)" hours, ";
  166. 1660 printmid$(ti$,3,2)" minutes and "right$(ti$,2)" seconds!
  167. 1670 [139] ti$[179]"002000" [167] [153]"               good job!wait":[137]1690
  168. 1680 [153]" it takes practice"
  169. 1690 [153]"    more problems (y/n)";:[133] q$
  170. 1700 [139] [200](q$,1)[179][177]"y"[167] [153]"load":[128]
  171. 1710 [137]50
  172. 1720 [153]"press any key...
  173. 1730 get aa$:if aa$="" then1730
  174. 1740 return
  175. 1750 print"[147]this is problem #";p;"[157]."
  176. 1760 print" "xtab(11)a
  177. 1770 print" [195][195][195]   *   [195][195][195] ="
  178. 1